import request from '@/utils/request'
// import { formatUTC } from 'core-js/fn/date'

// 查询
export function getmutualList(data) {
  if (data.baseName == '') {
    return request({
      url: `/controlInteraction/page?remoteControlDeviceName=${data.remoteControlDeviceName}&limit=${data.limit}&page=${data.page}`,
      method: 'get'
    })
  }
  if (data.baseName != '') {
    return request({
      url: `/controlInteraction/page?remoteControlDeviceName=${data.remoteControlDeviceName}&baseName=${data.baseName}&limit=${data.limit}&page=${data.page}`,
      method: 'get'
    })
  }
}

// 查询水肥机
export function getWater(data) {
  return request({
    url: `/controlInteraction/selectWaterFertilizerMachineByBase/${data.baseName}`,
    method: 'get'
  })
}

// 新增
export function addmutualList(data) {
  return request({
    url: '/controlInteraction/insert',
    method: 'post',
    data
  })
}

// 删除
export function deletemutualList(data) {
  return request({
    url: `/controlInteraction/deleteONe/${data.controlInteractionId}`,
    method: 'post'
  })
}

// 批量删除
export function deletemutualLists(data) {
  return request({
    url: `/controlInteraction/deleteList?ids%5B%5D=${data.item}`,
    method: 'post'
  })
}

// 更新
export function updatemutualList(data) {
  return request({
    url: '/controlInteraction/update',
    method: 'post',
    data
  })
}

// 上传
export function uploadmutualList(data) {
  return request({
    url: `/controlInteraction/uploadFile`,
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data: data
  })
}
